<script setup lang="ts">
import type { RouteRecordRaw } from 'vue-router'

defineProps<{
  item: RouteRecordRaw
}>()
</script>

<template>
  <el-sub-menu v-if="item.children && item.children.length" :index="item.path">
    <template #title>{{ item.meta?.title || item.name }}</template>
    <MenuItem v-for="child in item.children" :key="child.path" :item="child" />
  </el-sub-menu>
  <el-menu-item v-else :index="item.path">
    {{ item.meta?.title || item.name }}
  </el-menu-item>
</template>
